!===============================================================
!
! Funzione Langerman modificata (n=5)
!
!===============================================================
!			VARIABLE BOUNDS
!===============================================================
!       0.D0              1.D+1          Limits of variable i
SUBROUTINE MODLANGERMAN(X,N,F)

      IMPLICIT NONE

      INTEGER          :: N
      DOUBLE PRECISION :: X(N), F
	  DOUBLE PRECISION :: C(5), A(5,5)
	  DOUBLE PRECISION :: D(5)
	  DOUBLE PRECISION, PARAMETER :: PI = 3.1415923D0
      INTEGER          :: I, J

	  DATA ((A(J,I), I=1,5), J=1,5) &
			/9.681D0, 0.667D0, 4.783D0, 9.095D0, 3.517D0,	&
			 9.400D0, 2.041D0, 3.788D0, 7.931D0, 2.882D0,	&
			 8.025D0, 9.152D0, 5.114D0, 7.621D0, 4.564D0,	&
			 2.196D0, 0.415D0, 5.649D0, 6.979D0, 9.510D0,	&
			 8.074D0, 8.777D0, 3.467D0, 1.867D0, 6.708D0/
	  DATA (C(I), I=1,5) /0.806D0, 0.517D0, 0.100D0, 0.908D0, 0.965D0/
      
	  DO J = 1,N
		D(J) = 0.D0
		DO I = 1,N
			D(J) = D(J) + (X(I)-A(J,I))**2.D0
		ENDDO
	  ENDDO

	  F = 0.D0

	  DO J = 1,N
		F = F - C(J)*DCOS(D(J)/PI)*DEXP(-PI*D(J))
	  ENDDO

      RETURN

END
